package it.probabili.formazioni.download.html;

import it.probabili.formazioni.download.base.DownloadBase;
import it.probabili.formazioni.test.Esegui;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;


public class DownloadHTML extends DownloadBase {

	@SuppressWarnings({ "resource", "finally" })
	public static List<String> generaListaIndirizziHTMLPartita(String nomeFile){
		Reader f;
		List<String> listaPartite = new ArrayList<String>(0);
		try {
			f = new FileReader(Esegui.class.getResource("/" + nomeFile + ".partite").getFile());			
			BufferedReader b= new BufferedReader(f);
		    
		    String str = "";
		    while(true){
		    	str = b.readLine();
		    	if(str!=null){
		    		listaPartite.add(str);
		    	}else{
		    		return listaPartite;
		    	}
		    }
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			return listaPartite;
		}
		
	}
	
}
